Extracting Events using Nltk

by: ryanrg, 7 years ago

Last edited: 7 years ago


stop_words = set(stopwords.words('english'))
print(stop_words )
ne_1 = word_tokenize(sample)

filtered_sentence = [w for w in ne_1 if not w in stop_words]
filtered_sentence = []

for w in ne_1:
    if w not in stop_words:
        filtered_sentence.append(w)

filtered_sentence

   # ne_tree = ne_chunk(pos_tag(word_tokenize(sample)))

ne_2 = pos_tag(filtered_sentence)
ne_2
ne_3 = ne_chunk(ne_2)
ne_3

When I run this it detects States like Texas as an Organizations, dont know why.

Eg: "There is a Python Conference at the cafe in Texas on 1/6/2017 "


My main Goal
I am trying to extract a date related to the event.

Output required:
Python Conference  1/6/2017  Cafe Texas




You must be logged in to post. Please login or register an account.